In packet networks, such as Internet, information is transferred through a network from a source computer to a destination computer using packets called datagrams. The source computer and the destination computer are called as hosts. The network is an interconnection of the hosts and routers. The routers have input ports for receiving incoming packets and output ports for transmitting outgoing packets. The packets include data from the source computer and a destination address. The routers route the packets to a host or to another router based on the destination address and information stored in a routing table.
In the Internet protocol (IP), a route is either an indirect route or a direct route. When a route is an indirect route, the next destination is another router. A routing table entry indicates the next router's IP address and related routing information, such as the network interface connecting to the next router. When a route is a direct route, the next destination is the destination host. In this case, the routing table entry indicates the network interface to which the destination host is connected. Routing information is hierarchical in nature such that a destination address will include the address of the network and any sub-networks that host the destination node. A router often looks at the hierarchical routing information in an IP address to determine a next hop of a packet.